﻿using FAMailUtils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace famails
{
    public partial class autoredirection : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
            string secret = Request.QueryString["sc"];
            if (secret != null)
            {
                byte[] secretData = Convert.FromBase64String(secret);
                //byte[] secretData = Encoding.UTF8.GetBytes(secret);
                
                // Decrypt it using the public key
                byte[] decrypted = RSAPrivateEncryption.PublicDecryption(rsa, secretData);
                string decString = Encoding.Unicode.GetString(decrypted);  // And back to string
                string url = decString.Split('/')[0];
                string email = decString.Split('/')[1];
            }
        }
    }
}